package com.example.filemonitor.book.controller;


import com.example.filemonitor.book.service.IBookSearchService;
import com.example.filemonitor.book.service.IBookService;

import com.example.filemonitor.book.vo.SearchPage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/book")
public class BookController {

    @Resource
    private IBookSearchService bookSearchService;

    @Resource
    private IBookService bookService;

    @GetMapping("/init")
    public void initBooks(){
         bookService.initDirFilePathToDB();
    }



    @GetMapping("/search")
    public Object suggestSearch(SearchPage searchPage){
        return bookSearchService.search(searchPage);
    }
}
